home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Gamer Resource Kit / Hardcore Gamer Resource Kit - Disc 2.iso / Utils / UNIX / UNZIP520 / MSDOS / MAKEFILE.WAT < prev    next >
Text File  |  1996-03-12  |  8KB  |  257 lines

  1. # WMAKE makefile for 16 bit MSDOS or 32 bit DOS extender (PMODE/W or DOS/4GW)
  2. # using Watcom C/C++ v10.5, by Paul Kienitz, last revised 12 Mar 96.  Makes
  3. # UnZip.exe, fUnZip.exe, and UnZipSFX.exe.
  4. #
  5. # Invoke from UnZip source dir with "WMAKE -F MSDOS\MAKEFILE.WAT [targets]".
  6. # To make the PMODE/W version use "WMAKE PM=1 ..."
  7. # To make the DOS/4GW version use "WMAKE GW=1 ..." (overrides PM=1)
  8. #   Note: specifying PM or GW without NOASM requires that the win32 source
  9. #   directory be present, so it can access the 32 bit assembly source.
  10. #   PMODE/W is recommended over DOS/4GW for best performance.
  11. # To build with debug info use "WMAKE DEBUG=1 ..."
  12. # To build with no assembly modules use "WMAKE NOASM=1 ..."
  13. #
  14. # Other options to be fed to the compiler can be specified in an environment
  15. # variable called LOCAL_UNZIP.
  16.  
  17. variation = $(%LOCAL_UNZIP)
  18.  
  19. # Stifle annoying "Delete this file?" questions when errors occur:
  20. .ERASE
  21.  
  22. .EXTENSIONS:
  23. .EXTENSIONS: .exe .obj .obx .c .h .asm
  24.  
  25. # We maintain multiple sets of object files in different directories so that
  26. # we can compile msdos, dos/4gw, and win32 versions of UnZip without their
  27. # object files interacting.  The following var must be a directory name
  28. # ending with a backslash.  All object file names must include this macro
  29. # at the beginning, for example "$(O)foo.obj".
  30.  
  31. !ifdef GW
  32. PM = 1      # both protected mode formats use the same object files
  33. !endif
  34.  
  35. !ifdef PM
  36. O = ob32d\  # comment here so backslash won't continue the line
  37. !else
  38. O = ob16d\  # ditto
  39. !endif
  40.  
  41. # The assembly hot-spot code in crc_i[3]86.asm is optional.  This section
  42. # controls its usage.
  43.  
  44. !ifdef NOASM
  45. crcob = $(O)crc32.obj
  46. crcox = $(O)crc32.obx
  47. !else   # !NOASM
  48. cvars = $+$(cvars)$- -DASM_CRC
  49. # "$+$(foo)$-" means expand foo as it has been defined up to now; normally,
  50. # this Make defers inner expansion until the outer macro is expanded.
  51. !  ifdef PM
  52. crcob = $(O)crc_i386.obj
  53. crcox = $(O)crc_i386.obx
  54. crc_s = win32\crc_i386.asm   # requires that the win32 directory be present
  55. !  else
  56. crcob = $(O)crc_i86.obj
  57. crcox = $(O)crc_i86.obx
  58. crc_s = msdos\crc_i86.asm
  59. !  endif
  60. !endif
  61.  
  62. # Our object files: OBJA/OBJB is for UnZip, OBJX for UnZipSFX, OBJF for fUnZip:
  63.  
  64. OBJA1 = $(O)unzip.obj $(crcob) $(O)crctab.obj $(O)crypt.obj $(O)envargs.obj
  65. OBJA  = $(OBJA1) $(O)explode.obj $(O)extract.obj $(O)fileio.obj $(O)globals.obj
  66. OBJB2 = $(O)inflate.obj $(O)list.obj $(O)match.obj $(O)process.obj $(O)ttyio.obj
  67. OBJB  = $(OBJB2) $(O)unreduce.obj $(O)unshrink.obj $(O)zipinfo.obj $(O)msdos.obj
  68.  
  69. OBJX2 = $(O)unzip.obx $(crcox) $(O)crctab.obx $(O)crypt.obx $(O)extract.obx
  70. OBJX1 = $(OBJX2) $(O)fileio.obx $(O)globals.obx $(O)inflate.obx $(O)match.obx
  71. OBJX  = $(OBJX1) $(O)process.obx $(O)ttyio.obx $(O)msdos.obx
  72.  
  73. OBJF1  = $(O)funzip.obj $(crcox) $(O)cryptf.obj $(O)globalsf.obj
  74. OBJF  = $(OBJF1) $(O)inflatef.obj $(O)ttyio.obx
  75. # fUnZip uses $(crcox) and $(O)ttyio.obx because they're small-model.
  76.  
  77. # Common header files included by all C sources:
  78.  
  79. UNZIP_H = unzip.h unzpriv.h globals.h msdos\doscfg.h
  80.  
  81. # Now we have to pick out the proper compiler and options for it.  This gets
  82. # pretty complicated with the PM, GW, DEBUG, and NOASM options...
  83.  
  84. link   = wlink
  85. asm    = wasm
  86.  
  87. !ifdef PM
  88. cc     = wcc386
  89. # Use Pentium timings, flat memory, static strings in code, max strictness:
  90. cflags = -bt=DOS -mf -5r -zt -zq -wx -we
  91. aflags = -bt=DOS -mf -3 -zq
  92. cflagx = $(cflags)
  93. aflagx = $(aflags)
  94.  
  95. !  ifdef GW
  96. lflags = sys DOS4G
  97. !  else
  98. # THIS REQUIRES THAT PMODEW.EXE BE FINDABLE IN THE COMMAND PATH.
  99. # It does NOT require you to add a pmodew entry to wlink.lnk or wlsystem.lnk.
  100. defaultlibs = libpath %WATCOM%\lib386 libpath %WATCOM%\lib386\dos
  101. lflags = format os2 le op osname='PMODE/W' op stub=pmodew.exe $(defaultlibs)
  102. !  endif
  103.  
  104. !else   # plain 16-bit DOS:
  105.  
  106. cc     = wcc
  107. # Use plain 8086 code, medium memory, static strings in code, max strictness:
  108. cflags = -bt=DOS -mm -0 -zt -zq -wx -we
  109. aflags = -bt=DOS -mm -0 -zq
  110. # for UnZipSFX and fUnZip, use the small memory model:
  111. cflagx = -bt=DOS -ms -0 -zt -zq -wx -we
  112. aflagx = -bt=DOS -ms -0 -zq
  113. lflags = sys DOS
  114. !endif  # !PM
  115.  
  116. cvars  = $+$(cvars)$- -DMSDOS $(variation)
  117. avars  = $+$(avars)$- $(variation)
  118.  
  119.  
  120. # Specify optimizations, or a nonoptimized debugging version:
  121.  
  122. !ifdef DEBUG
  123. cdebug = -od -d2
  124. cdebux = -od -d2
  125. ldebug = d w all op symf
  126. !else
  127. !  ifdef PM
  128. cdebug = -s -oeilrt -z4    # use longword data alignment in 32 bit version
  129. # note: -ol+ does not help.  -oa helps slightly but might be dangerous.
  130. !  else
  131. cdebug = -s -oeilrt
  132. !  endif
  133. cdebux = -s -oeilrs
  134. ldebug = op el
  135. !endif
  136.  
  137. # How to compile sources:
  138. .c.obx:
  139.     $(cc) $(cdebux) $(cflagx) $(cvars) -DSFX $< -fo=$@
  140.  
  141. .c.obj:
  142.     $(cc) $(cdebug) $(cflags) $(cvars) $< -fo=$@
  143.  
  144. # Here we go!  By default, make all targets, except no UnZipSFX for PMODE:
  145. !ifdef PM
  146. all: UnZip.exe fUnZip.exe
  147. !else
  148. all: UnZip.exe fUnZip.exe UnZipSFX.exe
  149. !endif
  150.  
  151. # Convenient shorthand options for single targets:
  152. u:   UnZip.exe    .SYMBOLIC
  153. f:   fUnZip.exe   .SYMBOLIC
  154. x:   UnZipSFX.exe .SYMBOLIC
  155.  
  156. UnZip.exe:    $(OBJA) $(OBJB)
  157.     set WLK_VA=file {$(OBJA)}
  158.     set WLK_VB=file {$(OBJB)}
  159.     $(link) $(lflags) $(ldebug) name $@ @WLK_VA @WLK_VB
  160.     set WLK_VA=
  161.     set WLK_VB=
  162. # We use WLK_VA/WLK_VB to keep the size of each command under 256 chars.
  163.  
  164. UnZipSFX.exe:    $(OBJX)
  165.     set WLK_VX=file {$(OBJX)}
  166.     $(link) $(lflags) $(ldebug) name $@ @WLK_VX
  167.     set WLK_VX=
  168.  
  169. fUnZip.exe:    $(OBJF)
  170.     set WLK_VF=file {$(OBJF)}
  171.     $(link) $(lflags) $(ldebug) name $@ @WLK_VF
  172.     set WLK_VF=
  173.  
  174.  
  175. # Source dependencies:
  176.  
  177. #       for UnZip ...
  178.  
  179. $(O)crc32.obj:    crc32.c $(UNZIP_H) zip.h
  180. $(O)crctab.obj:   crctab.c $(UNZIP_H) zip.h
  181. $(O)crypt.obj:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  182. $(O)envargs.obj:  envargs.c $(UNZIP_H)
  183. $(O)explode.obj:  explode.c $(UNZIP_H)
  184. $(O)extract.obj:  extract.c $(UNZIP_H) crypt.h
  185. $(O)fileio.obj:   fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  186. $(O)globals.obj:  globals.c $(UNZIP_H)
  187. $(O)inflate.obj:  inflate.c inflate.h $(UNZIP_H)
  188. $(O)list.obj:     list.c $(UNZIP_H)
  189. $(O)match.obj:    match.c $(UNZIP_H)
  190. $(O)process.obj:  process.c $(UNZIP_H)
  191. $(O)ttyio.obj:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  192. $(O)unreduce.obj: unreduce.c $(UNZIP_H)
  193. $(O)unshrink.obj: unshrink.c $(UNZIP_H)
  194. $(O)unzip.obj:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
  195. $(O)zipinfo.obj:  zipinfo.c $(UNZIP_H)
  196.  
  197. #       for UnZipSFX ...
  198.  
  199. $(O)crc32.obx:    crc32.c $(UNZIP_H) zip.h
  200. $(O)crctab.obx:   crctab.c $(UNZIP_H) zip.h
  201. $(O)crypt.obx:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  202. $(O)extract.obx:  extract.c $(UNZIP_H) crypt.h
  203. $(O)fileio.obx:   fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  204. $(O)globals.obx:  globals.c $(UNZIP_H)
  205. $(O)inflate.obx:  inflate.c inflate.h $(UNZIP_H)
  206. $(O)match.obx:    match.c $(UNZIP_H)
  207. $(O)process.obx:  process.c $(UNZIP_H)
  208. $(O)ttyio.obx:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  209. $(O)unzip.obx:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
  210.  
  211. # Special case object files:
  212.  
  213. $(O)msdos.obj:    msdos\msdos.c $(UNZIP_H)
  214.     $(cc) $(cdebug) $(cflags) $(cvars) msdos\msdos.c -fo=$@
  215.  
  216. $(O)msdos.obx:    msdos\msdos.c $(UNZIP_H)
  217.     $(cc) $(cdebux) $(cflagx) $(cvars) -DSFX msdos\msdos.c -fo=$@
  218.  
  219. !ifndef NOASM
  220. $(crcob):         $(crc_s)
  221.     $(asm) $(aflags) $(avars) $(crc_s) -fo=$@
  222.  
  223. $(crcox):         $(crc_s)
  224.     $(asm) $(aflagx) $(avars) $(crc_s) -fo=$@
  225. !endif
  226.  
  227. # Variant object files for fUnZip, using $(cflagx):
  228.  
  229. $(O)funzip.obj:   funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
  230.     $(cc) $(cdebux) $(cflagx) $(cvars) funzip.c -fo=$@
  231.  
  232. $(O)cryptf.obj:   crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  233.     $(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP crypt.c -fo=$@
  234.  
  235. $(O)globalsf.obj: globals.c $(UNZIP_H)
  236.     $(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP globals.c -fo=$@
  237.  
  238. $(O)inflatef.obj: inflate.c inflate.h $(UNZIP_H) crypt.h
  239.     $(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP inflate.c -fo=$@
  240.  
  241. $(O)ttyiof.obj:   ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  242.     $(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP ttyio.c -fo=$@
  243.  
  244. # Unwanted file removal:
  245.  
  246. clean:     .SYMBOLIC
  247. !ifdef PM
  248.     del ob32d\*.ob?
  249. !else
  250.     del ob16d\*.ob?
  251. !endif
  252.  
  253. cleaner:   clean  .SYMBOLIC
  254.     del UnZip.exe
  255.     del fUnZip.exe
  256.     del UnZipSFX.exe
  257.